package com.bnd.domain.session;

import lombok.Data;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

import java.nio.ByteBuffer;
import java.util.concurrent.atomic.AtomicBoolean;

/**
 * 音色发送器
 */
@Data
public class VoiceSender {
    private SseEmitter emitter;
    private Object lock = new Object();
    private ByteBuffer ttsByteBuffer;
    /**
     * 是否可以发送
     */
    private AtomicBoolean canSend;

    public VoiceSender() {
        this.emitter = new SseEmitter(60 * 1000L);
        this.canSend = new AtomicBoolean(true);
        ttsByteBuffer = ByteBuffer.allocate(10 * 1024);
    }

    public boolean canSend(){
        return canSend.get();
    }
}
